<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:wh="http://java.sun.com/jsf/composite/wh"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="template/template.xhtml">
		<ui:define name="content">
			<h:form id="form" styleClass="horizontal_full">
					<p:panel>
	
						<h1>Overall Game Settings</h1>
						<p>
							Allows you to configure the overall settings for the simulation that is used for all games.
						</p>
						<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
						<p:dataTable id="settingsTableCalculation" var="setting" scrollable="true"
							value="#{adminMBean.settings}">
	
							<f:facet name="header">
						            Image Calculation Setting
						    </f:facet>

							<p:column headerText="Marketing Factor" sortBy="#{setting.factorMarketing}">
								<h:inputText id="factorMarketing" value="#{setting.factorMarketing}" 
								converterMessage="Factor has to be positive."
								validatorMessage="Factor has to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
								
							<p:column headerText="Personal Factor" sortBy="#{setting.factorPersonal}">
								<h:inputText id="factorPersonal" value="#{setting.factorPersonal}" 
								converterMessage="Factor has to be positive."
								validatorMessage="Factor has to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="R&amp;D Factor" sortBy="#{setting.factorRD}">
								<h:inputText id="factorRD" value="#{setting.factorRD}" 
								converterMessage="Factor has to be positive."
								validatorMessage="Factor has to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Market Share Factor" sortBy="#{setting.factorMarketShare}">
								<h:inputText id="factorMarketShare" value="#{setting.factorMarketShare}" 
								converterMessage="Factor has to be positive."
								validatorMessage="Factor has to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
						</p:dataTable>
						<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
						<p></p>
							<p:dataTable id="settingsTableCompany" var="setting" scrollable="true"
							value="#{adminMBean.settings}">
	
							<f:facet name="header">
						            Company Settings for all Games
						    </f:facet>
	
							<p:column headerText="Start Image Company" sortBy="#{setting.startImageForCompanies}">
								<h:inputText id="startImageForCompanies" value="#{setting.startImageForCompanies}" 
								converterMessage="Image has to be between 0 and 1."
								validatorMessage="Image has to be between 0 and 1.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Free Portfolio Products" sortBy="#{setting.maxFreePortfolioProducts}">
								<h:inputText id="maxFreePortfolioProducts" value="#{setting.maxFreePortfolioProducts}" 
								converterMessage="Number has to be positive."
								validatorMessage="Number has to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Extra Costs per Product" sortBy="#{setting.portfolioExtraCostsPerProduct}">
								<h:inputText id="portfolioExtraCostsPerProduct" value="#{setting.portfolioExtraCostsPerProduct}" 
								converterMessage="Amount has to be positive."
								validatorMessage="Amount has to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Portfolio Rising Factor" sortBy="#{setting.portfolioFactor}">
								<h:inputText id="portfolioFactor" value="#{setting.portfolioFactor}" 
								converterMessage="Factor has to be between 2 and 10."
								validatorMessage="Factor has to be between 2 and 10.">
									<f:validateLongRange minimum="2" maximum="10"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Image Smoothing Factor" sortBy="#{setting.exponentialSmoothingFactor}">
								<h:inputText id="exponentialSmoothingFactor" value="#{setting.exponentialSmoothingFactor}" 
								converterMessage="Factor has to be between 0 and 1."
								validatorMessage="Factor has to be between 0 and 1.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Company Starting Budget" sortBy="#{setting.startBudgetForCompanies}">
								<h:inputText id="startBudgetForCompanies" value="#{setting.startBudgetForCompanies}" 
								converterMessage="Budget has to be positive."
								validatorMessage="Budget has to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
						</p:dataTable>
						<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
						<p></p>
							<p:dataTable id="settingsTableMarket" var="setting" scrollable="true"
							value="#{adminMBean.settings}">
	
							<f:facet name="header">
						            Market Settings for all Games
						    </f:facet>
							
							<p:column headerText="Interest Rate" sortBy="#{setting.interestRate}">
								<h:inputText id="interestRate" value="#{setting.interestRate}" 
								converterMessage="Interest Rate has to be between 0 and 1."
								validatorMessage="Interest Rate has to be between 0 and 1.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
						</p:dataTable>
						<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
						<p></p>
						<p:dataTable id="settingsTableAgent" var="setting" scrollable="true"
							value="#{adminMBean.settings}">
	
							<f:facet name="header">
						            Agent Settings for all Games
						    </f:facet>
						    
							<p:column headerText="Minimum Consumer Utiliy" sortBy="#{setting.minimumConsumerUtility}">
								<h:inputText id="minimumConsumerUtility" value="#{setting.minimumConsumerUtility}" 
								converterMessage="Utility Rate has to be between 0 and 1."
								validatorMessage="Utility Rate has to be between 0 and 1.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>

							<p:column headerText="Variance of Preferences" sortBy="#{setting.preferenceVariance}">
								<h:inputText id="preferenceVariance" value="#{setting.preferenceVariance}" 
								converterMessage="Variance has to be between 0 and 1."
								validatorMessage="Variance has to be between 0 and 1.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Agents per Company" sortBy="#{setting.agentAmountCompanyFactor}">
								<h:inputText id="agentAmountCompanyFactor" value="#{setting.agentAmountCompanyFactor}" 
								converterMessage="Factor has to be positive."
								validatorMessage="Factor has to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Utility Precision" sortBy="#{setting.utilityPrecision}">
								<h:inputText id="utilityPrecision" value="#{setting.utilityPrecision}" 
								converterMessage="Value has to be positive."
								validatorMessage="Value has to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
							
						</p:dataTable>
						<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
						<p>Here it is possible to change the game initialization settings.</p>
						<p:dataTable id="settingsTableInitialization" var="setting" scrollable="true"
							value="#{adminMBean.settings}">
	
							<f:facet name="header">
						            Game Initialization Setting
						    </f:facet>

							<p:column headerText="Trade Margin" sortBy="#{setting.tradeMargin}">
								<h:inputText id="tradeMargin" value="#{setting.tradeMargin}" 
								converterMessage="Trade Margin has to be positive."
								validatorMessage="Trade Margin has to be positive.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Start Budget Factor" sortBy="#{setting.factorStartBudget}">
								<h:inputText id="factorStartBudget" value="#{setting.factorStartBudget}" 
								converterMessage="Start Budget Factor has to be positive."
								validatorMessage="Start Budget Factor has to be positive.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Logistic Costs Factor" sortBy="#{setting.factorLogisticCosts}">
								<h:inputText id="factorLogisticCosts" value="#{setting.factorLogisticCosts}" 
								converterMessage="Logistic Costs Factor has to be positive."
								validatorMessage="Logistic Costs Factor has to be positive.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
								
							<p:column headerText="Marketing Cost Factor" sortBy="#{setting.factorCostMarketing}">
								<h:inputText id="factorCostMarketing" value="#{setting.factorCostMarketing}" 
								converterMessage="Marketing Cost Factor has to be positive."
								validatorMessage="Marketing Cost Factor has to be positive.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="R&amp;D Cost Factor" sortBy="#{setting.factorCostRD}">
								<h:inputText id="factorCostRD" value="#{setting.factorCostRD}" 
								converterMessage="R&amp;D Cost Factor has to be positive."
								validatorMessage="R&amp;D Cost Factor has to be positive.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Personal Cost Factor" sortBy="#{setting.factorCostPersonal}">
								<h:inputText id="factorCostPersonal" value="#{setting.factorCostPersonal}" 
								converterMessage="Personal Cost Factor has to be positive."
								validatorMessage="Personal Cost Factor has to be positive.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Report Small Factor" sortBy="#{setting.factorReportSmall}">
								<h:inputText id="factorReportSmall" value="#{setting.factorReportSmall}" 
								converterMessage="Report Small Factor has to be positive."
								validatorMessage="Report Small Factor has to be positive.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Report Middle Factor" sortBy="#{setting.factorReportMiddle}">
								<h:inputText id="factorReportMiddle" value="#{setting.factorReportMiddle}" 
								converterMessage="Report Middle Factor has to be positive."
								validatorMessage="Report Middle Factor has to be positive.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Report Big Factor" sortBy="#{setting.factorReportBig}">
								<h:inputText id="factorReportBig" value="#{setting.factorReportBig}" 
								converterMessage="Report Big Factor has to be positive."
								validatorMessage="Report Big Factor has to be positive.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Report Spy Factor" sortBy="#{setting.factorReportSpy}">
								<h:inputText id="factorReportSpy" value="#{setting.factorReportSpy}" 
								converterMessage="Report Spy Factor has to be positive."
								validatorMessage="Report Spy Factor has to be positive.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							
						</p:dataTable>
						<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
						<p>Here it is possible to change the game initialization settings for the investments.</p>
						<p:dataTable id="settingsTableInitializationInvestment" var="setting" scrollable="true"
							value="#{adminMBean.settings}">
	
							<f:facet name="header">
						            Game Initialization Investment Settings
						    </f:facet>
	
							<p:column headerText="Max Costs Marketing" sortBy="#{setting.maxCostsMarketing}">
								<h:inputText id="maxCostsMarketing" value="#{setting.maxCostsMarketing}" 
								converterMessage="Max Costs Marketing have to be positive."
								validatorMessage="Max Costs Marketing have to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Max R&amp;D Costs" sortBy="#{setting.maxCostsRD}">
								<h:inputText id="maxCostsRD" value="#{setting.maxCostsRD}" 
								converterMessage="Max R&amp;D Costs have to be positive."
								validatorMessage="Max R&amp;D Costs have to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
							
							<p:column headerText="Max Personal Costs" sortBy="#{setting.maxCostsPersonal}">
								<h:inputText id="maxCostsPersonal" value="#{setting.maxCostsPersonal}" 
								converterMessage="Max Personal Costs have to be positive."
								validatorMessage="Max Personal Costs have to be positive.">
									<f:validateLongRange minimum="0"/>
								</h:inputText>
							</p:column>
							
						</p:dataTable>
						<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
						<p></p>
						<p:commandButton value="Reload" action="#{adminMBean.actionRefreshSettings()}" update="form" icon="ui-icon-refresh"/>
						<p:commandButton value="Save Overall Game Settings"
							actionListener="#{adminMBean.actionSaveAndRefreshSetting}"
							update="form" icon="ui-icon-disk" />	

					</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>